<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>jQote2 QUnit Simple Test Suite // aefxx.com</title>
        <link type="image/x-icon" href="favicon.ico" rel="Shortcut Icon">
        <link rel="stylesheet" href="external/qunit.css" type="text/css"/>
        <script src="external/jquery-1.4.2.min.js" type="text/javascript"></script>
        <script src="external/qunit.js" type="text/javascript"></script>
        <script src="jquery.jqote2.js" type="text/javascript"></script>
    </head>
    <body>
        <h1 id="qunit-header">jQote2 QUnit Simple Test Suite</h1>
        <h2 id="qunit-banner"></h2>
        <h2 id="qunit-userAgent"></h2>
        <ol id="qunit-tests"></ol>
        <div id="dummy"></div>
        <script type="text/javascript">
            $(function() {
                module('Core');

                test('basic requirements', function() {
                    expect(6);
                    ok( $.fn.jqote, 'jQote2' );
                    ok( $.jqote, 'jQote2 static' );
                    ok( $.fn.jqoteapp, 'jQote2 append' );
                    ok( $.fn.jqotepre, 'jQote2 prepend' );
                    ok( $.fn.jqotesub, 'jQote2 substitute' );
                    ok( $.jqotec, 'jQote2 compile' );
                });

                module('Shorthand tag');

                test('basic tests', function() {
                    expect(3);
                    equal($('#sb1').jqote({str: 'Hello World'}), 'Hello World');
                    equal($('#sb2').jqote({a: 25, b: 2}), '25 % 2 = 1');
                    equal($('#sb3').jqote({
                        a: function(b) {return 'Hello ' + b();},
                        b: function() {return 'Mr. O\'Brian';}
                    }), '"Hello Mr. O\'Brian"');
                });

                test('advanced tests', function() {
                    expect(2);
                    equal($('#sa1').jqote([{x: 0}]), '0123456789');
                    equal($('#sa2').jqote([{n: 7}]), '13');
                });

                module('Standard tag');

                test('basic tests', function() {
                    expect(4);
                    equal($('#stdb1').jqote([{name: 'aefxx'}]), 'Hi, my name is aefxx.');
                    equal($('#stdb2').jqote([{a: 25, b: 2}]), '25 % 2 = 1');
                    equal($('#stdb3').jqote([{x: 3}]), 'IEEE 754');
                    equal($('#stdb4').jqote([{x: 3}]), 'GNU is Not Unix');
                });
            });
        </script>
        <script id="sb1" type="text/x-jqote-template">
            <![CDATA[
                <%= this.str %>
            ]]>
        </script>
        <script id="sb2" type="text/x-jqote-template">
            <![CDATA[
                <%= this.a %> % <%= this.b %> = <%= this.a % this.b %>
            ]]>
        </script>
        <script id="sb3" type="text/x-jqote-template">
            <![CDATA[
                "<%= this.a(this.b) %>"
            ]]>
        </script>
        <script id="sa1" type="text/x-jqote-template">
            <![CDATA[
                <%= this.x + ( j < 8 ? data[j+1] = {x: j+1, y: ''} : {y: '9'}).y %>
            ]]>
        </script>
        <script id="sa2" type="text/x-jqote-template">
            <![CDATA[
                <%= ( ( this.n === 0 ) ?
                        0 : ( this.n === 1 || this.n === 2 ) ?
                            1 : parseInt($.jqote(fn, {n: this.n-1}), 10) + parseInt($.jqote(fn, {n: this.n-2}), 10) )
                %>
            ]]>
        </script>
        <script id="stdb1" type="text/x-jqote-template">
            <![CDATA[
                Hi, my name is <% out += this.name; %>.
            ]]>
        </script>
        <script id="stdb2" type="text/x-jqote-template">
            <![CDATA[
                <% out += this.a; %> % <% out += this.b; %> = <% if ( this.a % this.b ) %>1<% else %>0
            ]]>
        </script>
        <script id="stdb3" type="text/x-jqote-template">
            <![CDATA[
                I<% while ( this.x-- ) %>E<% ; %> 754
            ]]>
        </script>
        <script id="stdb4" type="text/x-jqote-template">
            <![CDATA[
                <% while ( this.x )
                       switch ( this.x-- ) {
                           case 3:
                               %>GNU is <%
                               break;
                           case 2:
                               %>Not <%
                               break;
                           default:
                               %>Unix<%
                       } %>
            ]]>
        </script>
    </body>
</html>
